﻿#include "processor.hpp"

std::map<uint64_t, Atomic<std::array<uint8_t, 64>>> global_ram;

int main()
{
	std::ifstream input("boot.bin", std::ios::binary);
	if (!input.is_open())
		return -1;
	int size = 1024;
	input.seekg(0, std::ios::beg);
	for (int i = 0; i < 4096; i++)
		global_ram[i] = Atomic<std::array<uint8_t, 64>>();
	for (int i = 0; i < 64; i++)
	{
		global_ram[i].w_lock();
		input.read((char *)global_ram[i].get().data(), 64);
		global_ram[i].w_unlock();
	}
	Atomic<IOBus *> bus;
	bus = Atomic<IOBus *>(new IOBus());
	bus.setup();
	Processor proc;
	proc.init(bus);
	proc.run();
	return 0;
}